package com.yupi.yuoj.judge.codesanbox.impl;

import com.yupi.yuoj.judge.codesanbox.CodeSandbox;
import com.yupi.yuoj.judge.codesanbox.mode.dto.ExecuteCodeRequest;
import com.yupi.yuoj.judge.codesanbox.mode.dto.ExcuteCodeResponse;
import com.yupi.yuoj.judge.codesanbox.mode.enums.JudgeInfo;
import com.yupi.yuoj.model.enums.JudgeInfoMessageEnum;
import com.yupi.yuoj.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * 示范代码沙箱
 */
public class ExamplCodeSandbox implements CodeSandbox {
    @Override
    public ExcuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        List<String> inputList = executeCodeRequest.getInputList();
        String code = executeCodeRequest.getCode();
        String language = executeCodeRequest.getLanguage();

        ExcuteCodeResponse excuteCodeResponse = new ExcuteCodeResponse();
        excuteCodeResponse.setOutPutList(inputList);
        excuteCodeResponse.setMessage("测试成功");
        excuteCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getValue());
        judgeInfo.setMemory(100L);
        judgeInfo.setLimit(100L);
        excuteCodeResponse.setJudgeInfo(judgeInfo);
        return excuteCodeResponse;
    }
}
